home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Examples / PacMan / PacManInfoController.m < prev    next >
Text File  |  1995-06-12  |  1KB  |  38 lines

  1.  
  2. #import <soundkit/Sound.h>
  3. #import "PacManInfoController.h"
  4.  
  5. @implementation PacManInfoController
  6.  
  7. // Pressing the invisible button in the info panel starts the PacMan music.
  8. // When this happens, the game's sounds are temporarily turned off.
  9. // We then turn them back on when the sound finishes playing.  If a new
  10. // game is started while we're playing, then we abort the sound so that
  11. // the game's effects can come back.
  12. - playSound:sender
  13. { // load sound if first time playing...
  14.     if (!sound) sound = [[[Sound alloc]
  15.             initFromSection:"InfoMusic.snd"] setDelegate:self];
  16.     [[[NXApp delegate] soundPlayer] turnOn:NO]; // temp. turn off sound player
  17.     [sound play];
  18.     return self;
  19. }
  20.  
  21. - stopSound:sender
  22. { // will stop the sound (if playing) 
  23.     [sound stop];
  24.     // be sure to turn sound player back on
  25.     [[[NXApp delegate] soundPlayer]
  26.             turnOn:[[[NXApp delegate] preferencesBrain] effects]];
  27.     return self;
  28. }
  29.  
  30. - didPlay:sender
  31. { // turn sound player back on
  32.     [[[NXApp delegate] soundPlayer]
  33.             turnOn:[[[NXApp delegate] preferencesBrain] effects]];
  34.     return self;
  35. }
  36.  
  37. @end
  38.